import Sprite from '../../utils/canvas/sprite.js';
import * as Painter from '../../utils/canvas/painter.js';

export const bg = new Sprite('背景', Painter.bgPainter, []);
export const pic = new Sprite('图片', Painter.picPainter, []);
export const content = new Sprite('文字', Painter.textPainter, []);
export const content2 = new Sprite('文字2', Painter.textPainter, []);
export const title_ = new Sprite('标题', Painter.titlePainter, []);
export const pc_ = new Sprite('图片2', Painter.pcPainter, [])


// 画布参数
const res = wx.getSystemInfoSync();// 获取设备当前属性
const canvasW = Math.round(res.windowWidth*.9);
const canvasH = Math.round(canvasW*1.07);
const cxt_bg = 350 ;// 画布宽度
const bg_w = canvasW;// 卡片宽度
console.log(canvasW, canvasH, '123');

let left = 0;
let fontSize = Math.round(res.windowWidth * .06)

// console.log(left, '--');

// 背景属性设置
bg.setAttr({
  left: left,
  top: 0,
  width: bg_w,
  pixelRatio: res.pixelRatio,
  height: canvasH
});

// 图片对象属性设置
pic.setAttr({
  left: left,
  top: 0,
  width: bg_w,
  height: Math.round(bg_w / 1.3),
});

// 文字对象属性设置
content.setAttr({
  left: bg_w / 2 + 50 ,
  top: canvasH * .85,
  width: bg_w / 2,
  fontSize: fontSize,
  text: '-- 桂纶镁'
});
// 文字对象属性设置
content2.setAttr({
  left: left + 10,
  top: canvasH * .75,
  width: 200,
  fontSize: fontSize,
  lineheight: 30,
  text: '不能说的秘密^o^'
});

// title 定位等属性
title_.setAttr({
  left: left + 10,
  top: canvasH * .85,
  width: 100,
  lineheight: 30,
  text: '标题'
});

// pc 定位等属性
pc_.setAttr({
  left: left + 32,
  top: canvasH * .85,
  width: 100,
  lineheight: 30,
  text: '(你妹的)'
});